package com.xbongbong.workflow.domain.entity;

import com.xbongbong.paas.enums.DelEnum;
import com.xbongbong.paas.toolbox.util.DateTimeUtil;
import lombok.Getter;
import lombok.Setter;

import java.io.Serializable;

/**
 * 
 * tb_workflow_node
 * 
 */
@Getter
@Setter
public class WorkflowNodeEntity implements Serializable {
    /**
     * 主键
     */
    private Long id;

    /**
     * 公司id
     */
    private String corpid;

    /**
     * 工作流节点名称
     */
    private String name;

    /**
     * 触发类型: 0非触发节点，1 表单事件触发，2 时间触发，3 时间字段触发 4 webhook触发 5 员工事件触发 6 自定义触发方式
     * @see WorkflowTriggerMethodEnum
     */
    private Integer triggerType;

    /**
     * 节点类型：1.开始节点，2.结束节点，3.流程节点，4.抄送节点 ，5.条件节点，6条件块节点，11. 新建记录节点，12. 更新记录节点，13.删除记录节点，14.获取多条数据节点, 21. 发送消息节点
     * @see com.xbongbong.workflow.enums.WorkflowNodeTypeEnum
     */
    private Integer type;

    /**
     * 触发表单应用id
     */
    private Long appId;

    /**
     * 触发表单id
     */
    private Long formId;

    /**
     * 触发表单menu_id
     */
    private Long menuId;

    private Integer saasMark;

    private Integer businessType;

    /**
     * 所属工作流id
     */
    private Long workflowId;

    /**
     * 前端所需唯一标识
     */
    private String uid;

    /**
     * 上级节点id
     */
    private String prevId;

    /**
     * 所属条件块id
     */
    private String wrapperId;

    /**
     * 优先级
     */
    private Integer priority;

    /**
     * 不同类型的节点，配置信息不同具体见核心数据结构设计
     */
    private String configData;
    /**
     * 备注
     */
    private String memo;

    /**
     * 创建时间时间戳
     */
    private Long addTime;

    /**
     * 更新时间时间戳
     */
    private Long updateTime;

    /**
     * 删除标记
     */
    private Integer del;

    private static final long serialVersionUID = 1L;

    public WorkflowNodeEntity() {
    }

    public WorkflowNodeEntity(String corpid, String name, Integer triggerType, Integer type, Long appId, Long formId, Long menuId, Integer saasMark, Integer businessType, Long workflowId, String uid, String prevId, String wrapperId, Integer priority, String configData) {
        this.corpid = corpid;
        this.name = name;
        this.triggerType = triggerType;
        this.type = type;
        this.appId = appId;
        this.formId = formId;
        this.menuId = menuId;
        this.saasMark = saasMark;
        this.businessType = businessType;
        this.workflowId = workflowId;
        this.uid = uid;
        this.prevId = prevId;
        this.wrapperId = wrapperId;
        this.priority = priority;
        this.configData = configData;
        this.addTime = DateTimeUtil.getInt();
        this.updateTime = DateTimeUtil.getInt();
        this.del = DelEnum.NORMAL.getDel();
    }

    public WorkflowNodeEntity(String corpid, String name, Integer triggerType, Integer type, Long appId, Long formId, Long menuId, Integer saasMark, Integer businessType, Long workflowId, String uid, String prevId, String wrapperId, Integer priority, String configData, String memo) {
        this.corpid = corpid;
        this.name = name;
        this.triggerType = triggerType;
        this.type = type;
        this.appId = appId;
        this.formId = formId;
        this.menuId = menuId;
        this.saasMark = saasMark;
        this.businessType = businessType;
        this.workflowId = workflowId;
        this.uid = uid;
        this.prevId = prevId;
        this.wrapperId = wrapperId;
        this.priority = priority;
        this.configData = configData;
        this.memo = memo;
        this.addTime = DateTimeUtil.getInt();
        this.updateTime = DateTimeUtil.getInt();
        this.del = DelEnum.NORMAL.getDel();
    }
}